<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="<?php echo site_url('static/style/js/jquery.js');?>"></script>
<script type="text/javascript" src="<?php echo site_url('static/style/js/dialog.js');?>"></script>
<link href="<?php echo site_url('static/style/css/dialog.css');?>" rel="stylesheet" type="text/css" />
<title>抽奖管理后台</title>

<style>
body{background:#F4F4FF; font-size:14px; margin:auto}
.divScroll{     OVERFLOW:auto;
        scrollbar-face-color: #FFFFFF;
        scrollbar-shadow-color: #D2E5F4;
        scrollbar-highlight-color: #D2E5F4;
        scrollbar-3dlight-color: #FFFFFF;
        scrollbar-darkshadow-color: #FFFFFF;
        scrollbar-track-color: #FFFFFF; 
      scrollbar-arrow-color: #D2E5F4;
	  }
</style>
<script type="text/javascript">
var div = '';

	function openwin(url)
	{
		window.location=''+url+'';
	}

	function addstock(id)
	{
		$("#productid").val(id);
		 dialog("我的标题","id:pop","300px","auto","id");
		 div = $("#pop").html();
		 $("#pop").html('');
	}

	//关闭POP
	function closepop(tar)
	{
		$("#floatBoxBg").animate({opacity:"0"},"normal",function(){$(this).hide();});
		$("#floatBox").css({display:"none"});
		var id = '#'+tar;
		$(id).html(div);
	}

	function submitp()
	{
		var cardnum   = $("#cardnum").val();
		var productid = $("#productid").val();
		if(cardnum !='' && productid !=''){
			
			$.post("stock/addstock",{cardnum:cardnum, productid:productid},function(result){
				if(result > 0){
					closepop('pop');
					location.reload();
				}else{
					alert('发生错误，请重试');
					closepop('pop');
				}
				
			});
			
		}

	}

	function delstock(id)
	{
		if(id !=''){
			
			$.post("stock/delstock",{id:id},function(result){
				if(result > 0){
					location.reload();
				}else{
					alert('发生错误，请重试');
				}
				
			});
			
		}
	}
		
</script>
</head>

<body topmargin="0">
<div id="pop" style="display:none">
<form name="form1"> 
	<table width="333" border="0" cellpadding="0">
	  <tr>
	    <td width="329" height="23">添加属性</td>
	  </tr>
	  <tr>
	    <td height="61" align="center">
	     	<input type="hidden" name="productid"  id="productid"/>
	        <input type="text" name="cardnum" value="" id="cardnum" />
	
	    </td>
	  </tr>
	  <tr>
	    <td height="26" align="center">
	        <input type="button" name="button" id="button" value="添加" onclick="submitp();"/>
	        <input type="button" value="取消" onclick="closepop('pop');" />
	    </td>
	  </tr>
	</table>
</form>
</div>
<table width="1000px" border="0" cellpadding="0" bgcolor="#F4F4FF">
  <tr>
    <td width="235" height="37">&nbsp;</td>
    <td width="759">&nbsp;</td>
  </tr>
  <tr>
    <td height="30">&nbsp;</td>
    <td>
        <input type="button" value="返回"  onclick="history.back();"/>
    </td>
  </tr>
  <tr>
    <td height="485" align="center" valign="top">
<?php require_once 'left.php';?>
    </td>
    <td valign="top" align="center">
	<div align="center" style="width: 90%px; height: 500px; background:#FFFFFF" class="divScroll">
		 <table width="100%" border="0" cellpadding="0">
		
          <tr onMouseMove="javascript:this.bgColor='#FCFDEE';"
		onMouseOut="javascript:this.bgColor='#FFFFFF';">
            <td width="100%">
           <table width="100%" border="0" cellspacing="1" bgcolor="#CCCCCC">
      <tr align="center">
        <td  height="31" bgcolor="#CCCCCC">ID</td>
        <td  bgcolor="#CCCCCC">号码</td>
        <td  bgcolor="#CCCCCC">购买人</td>
        <td bgcolor="#CCCCCC">时间</td>
        <td  bgcolor="#CCCCCC"></td>
      </tr>
      <?php foreach($list as $key => $value){ ?>
      <tr align="center">
        <td height="34" bgcolor="#FFFFFF"><?=$value['id']?></td>
        <td bgcolor="#FFFFFF">
        <?php if(!empty($value['productid'])){?>
        <font color='red'>
        	<?=$value['rnum']?>
        </font>
        <?php }else{?>
        <?=$value['rnum']?>
        <?php }?>
        </td>
        <td bgcolor="#FFFFFF"><?=$value['txemail']?></td>
        <td bgcolor="#FFFFFF"><?php echo $value['createtime'] ? date('Y-m-d',$value['createtime']) : '';?></td>
        <td bgcolor="#FFFFFF"><?php echo $value['uid'] ? '<font color=red>已被购买</font>' : '未购买';?></td>
      </tr>
      <?php } ?>
	  <tr>
        <td height="34" colspan="9" bgcolor="#FFFFFF"></td>
        </tr>
    </table>
            </td>
          </tr>
              

                    

                    
        </table>
	<div>
    
    </td>
  </tr>
</table>
</body>
</html>
